{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "fe1508f4",
   "metadata": {},
   "source": [
    "## 元组（tuple）\n",
    "\n",
    "*[元组]（网址）\n",
    "\n",
    "1.它是和List几乎完全一样的序列数据\n",
    "\n",
    "2.它与list不同的地方是，**不可变**（因为不可变，所以几乎没有方法）\n",
    "\n",
    "3.元组的形式：（1，2，3，4，5）对比  元组（）  列表[]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4201fe65",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "('10001', '10002', '10003') <class 'tuple'>\n"
     ]
    }
   ],
   "source": [
    "stu_id = \"10001\",\"10002\",\"10003\"\n",
    "print(stu_id,type(stu_id))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d7549b54",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_id.count(\"10001\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "2f5dd635",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_id.count(\"10002\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "d543664a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stu_id.count(\"10003\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "d5442040",
   "metadata": {},
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name 'time' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-6-9dcdd31be90f>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mtime\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mlocaltime\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m: name 'time' is not defined"
     ]
    }
   ],
   "source": [
    "time.localtime()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a8d06402",
   "metadata": {},
   "source": [
    "#字典\n",
    "\n",
    ">1.创建字典的三种常见方法\n",
    ">>1.直接按照字典的格式创建：{key:value1,key2:value2,……}\n",
    ">>2.dict()函数来创建字典：dict(key1=value1,key2=value2,……)\n",
    ">>3.字典数据增加的方式：新建空字典 dict_name = [],dict_name[key1]=value1……\n",
    ">>4.字典的性质"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "a60e22ed",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'stud_10001': 'Alex', 'stud_10002': 'Jack', 'stud_10003': 'Marry'}"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 1.直接按照字典的格式创建：{key:value1,key2:value2,……}\n",
    "stud_info ={#只有字典里面会有冒号\n",
    "    \"stud_10001\":\"Alex\",\n",
    "    \"stud_10002\":\"Jack\",\n",
    "    \"stud_10003\":\"Marry\"\n",
    "    \n",
    "}  \n",
    "stud_info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "4a4ca8c4",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'stud_10001': 'Alex', 'stud_10002': 'Jack', 'stud_10003': 'Marry'}"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#2.dict()函数来创建字典：dict(key1=value1,key2=value2,……)\n",
    "stud_info_02 = dict(\n",
    "    stud_10001 = \"Alex\",\n",
    "    stud_10002 = \"Jack\",\n",
    "    stud_10003 = \"Marry\",\n",
    ")\n",
    "stud_info_02"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "79808cb7",
   "metadata": {},
   "outputs": [],
   "source": [
    "stud_info_o3 = {}\n",
    "stud_info_03[\"stud_10001\"] = \"Alex\"\n",
    "stud_info_03[\"stud_10001\"] = \"Alex\"\n",
    "stud_info_03[\"stud_10001\"] = \"Alex\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
